<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Gets available cipher methods</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-free-key.html">openssl_free_key</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.openssl-get-md-methods.html">openssl_get_md_methods</a></div>
 <div class="up"><a href="ref.openssl.html">OpenSSL 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.openssl-get-cipher-methods" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_get_cipher_methods</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0)</p><p class="refpurpose"><span class="refname">openssl_get_cipher_methods</span> &mdash; <span class="dc-title">Gets available cipher methods</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-get-cipher-methods-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><strong>openssl_get_cipher_methods</strong></span>
    ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$aliases</code><span class="initializer"> = false</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Gets a list of available cipher methods.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-get-cipher-methods-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">aliases</code></em></dt>

     <dd>

      <p class="para">
       Set to <strong><code>TRUE</code></strong> if cipher aliases should be included within the
       returned <span class="type"><a href="language.types.array.html" class="type array">array</a></span>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-get-cipher-methods-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   An <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of available cipher methods.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.openssl-get-cipher-methods-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-836">
    <p><strong>Example #1 <span class="function"><strong>openssl_get_cipher_methods()</strong></span> example</strong></p>
    <div class="example-contents"><p>
     Shows how the available ciphers might look, and also which aliases
     might be available.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$ciphers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">openssl_get_cipher_methods</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$ciphers_and_aliases&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">openssl_get_cipher_methods</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cipher_aliases&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_diff</span><span style="color: #007700">(</span><span style="color: #0000BB">$ciphers_and_aliases</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$ciphers</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$ciphers</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$cipher_aliases</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [0] =&gt; AES-128-CBC
    [1] =&gt; AES-128-CFB
    [2] =&gt; AES-128-CFB1
    [3] =&gt; AES-128-CFB8
    [4] =&gt; AES-128-ECB
    [5] =&gt; AES-128-OFB
    [6] =&gt; AES-192-CBC
    [7] =&gt; AES-192-CFB
    [8] =&gt; AES-192-CFB1
    [9] =&gt; AES-192-CFB8
    [10] =&gt; AES-192-ECB
    [11] =&gt; AES-192-OFB
    [12] =&gt; AES-256-CBC
    [13] =&gt; AES-256-CFB
    [14] =&gt; AES-256-CFB1
    [15] =&gt; AES-256-CFB8
    [16] =&gt; AES-256-ECB
    [17] =&gt; AES-256-OFB
    [18] =&gt; BF-CBC
    [19] =&gt; BF-CFB
    [20] =&gt; BF-ECB
    [21] =&gt; BF-OFB
    [22] =&gt; CAST5-CBC
    [23] =&gt; CAST5-CFB
    [24] =&gt; CAST5-ECB
    [25] =&gt; CAST5-OFB
    [26] =&gt; DES-CBC
    [27] =&gt; DES-CFB
    [28] =&gt; DES-CFB1
    [29] =&gt; DES-CFB8
    [30] =&gt; DES-ECB
    [31] =&gt; DES-EDE
    [32] =&gt; DES-EDE-CBC
    [33] =&gt; DES-EDE-CFB
    [34] =&gt; DES-EDE-OFB
    [35] =&gt; DES-EDE3
    [36] =&gt; DES-EDE3-CBC
    [37] =&gt; DES-EDE3-CFB
    [38] =&gt; DES-EDE3-OFB
    [39] =&gt; DES-OFB
    [40] =&gt; DESX-CBC
    [41] =&gt; IDEA-CBC
    [42] =&gt; IDEA-CFB
    [43] =&gt; IDEA-ECB
    [44] =&gt; IDEA-OFB
    [45] =&gt; RC2-40-CBC
    [46] =&gt; RC2-64-CBC
    [47] =&gt; RC2-CBC
    [48] =&gt; RC2-CFB
    [49] =&gt; RC2-ECB
    [50] =&gt; RC2-OFB
    [51] =&gt; RC4
    [52] =&gt; RC4-40
    [53] =&gt; aes-128-cbc
    [54] =&gt; aes-128-cfb
    [55] =&gt; aes-128-cfb1
    [56] =&gt; aes-128-cfb8
    [57] =&gt; aes-128-ecb
    [58] =&gt; aes-128-ofb
    [59] =&gt; aes-192-cbc
    [60] =&gt; aes-192-cfb
    [61] =&gt; aes-192-cfb1
    [62] =&gt; aes-192-cfb8
    [63] =&gt; aes-192-ecb
    [64] =&gt; aes-192-ofb
    [65] =&gt; aes-256-cbc
    [66] =&gt; aes-256-cfb
    [67] =&gt; aes-256-cfb1
    [68] =&gt; aes-256-cfb8
    [69] =&gt; aes-256-ecb
    [70] =&gt; aes-256-ofb
    [71] =&gt; bf-cbc
    [72] =&gt; bf-cfb
    [73] =&gt; bf-ecb
    [74] =&gt; bf-ofb
    [75] =&gt; cast5-cbc
    [76] =&gt; cast5-cfb
    [77] =&gt; cast5-ecb
    [78] =&gt; cast5-ofb
    [79] =&gt; des-cbc
    [80] =&gt; des-cfb
    [81] =&gt; des-cfb1
    [82] =&gt; des-cfb8
    [83] =&gt; des-ecb
    [84] =&gt; des-ede
    [85] =&gt; des-ede-cbc
    [86] =&gt; des-ede-cfb
    [87] =&gt; des-ede-ofb
    [88] =&gt; des-ede3
    [89] =&gt; des-ede3-cbc
    [90] =&gt; des-ede3-cfb
    [91] =&gt; des-ede3-ofb
    [92] =&gt; des-ofb
    [93] =&gt; desx-cbc
    [94] =&gt; idea-cbc
    [95] =&gt; idea-cfb
    [96] =&gt; idea-ecb
    [97] =&gt; idea-ofb
    [98] =&gt; rc2-40-cbc
    [99] =&gt; rc2-64-cbc
    [100] =&gt; rc2-cbc
    [101] =&gt; rc2-cfb
    [102] =&gt; rc2-ecb
    [103] =&gt; rc2-ofb
    [104] =&gt; rc4
    [105] =&gt; rc4-40
)
Array
(
    [18] =&gt; AES128
    [19] =&gt; AES192
    [20] =&gt; AES256
    [21] =&gt; BF
    [26] =&gt; CAST
    [27] =&gt; CAST-cbc
    [32] =&gt; DES
    [47] =&gt; DES3
    [48] =&gt; DESX
    [50] =&gt; IDEA
    [55] =&gt; RC2
    [82] =&gt; aes128
    [83] =&gt; aes192
    [84] =&gt; aes256
    [85] =&gt; bf
    [90] =&gt; blowfish
    [91] =&gt; cast
    [92] =&gt; cast-cbc
    [97] =&gt; des
    [112] =&gt; des3
    [113] =&gt; desx
    [115] =&gt; idea
    [120] =&gt; rc2
)

</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.openssl-get-cipher-methods-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.openssl-get-md-methods.html" class="function" rel="rdfs-seeAlso">openssl_get_md_methods()</a> - Gets available digest methods</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-free-key.html">openssl_free_key</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.openssl-get-md-methods.html">openssl_get_md_methods</a></div>
 <div class="up"><a href="ref.openssl.html">OpenSSL 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
